<template>
  <div>
    <div v-if="dataList.length>2" class="numTip">上期测评结果</div>
    <div class="flex justifyContentSpaceBetween alignItemsCenter">
      <div v-if="dataList.length>2" class="numIm">
        {{dataList[dataList.length-1].hdFz}} <i>分</i>
      </div>
      <div v-if="dataList.length>1" class="jgTop">
        <div>{{dataList[dataList.length].hdMc}}</div>
        <div>第 {{dataList[dataList.length].hdPm}} 名</div>
      </div>
    </div>
    <el-table :data="dataList" max-height="200px">
      <el-table-column prop="hdMc" header-align="center" align="center" label="会议名称">
      </el-table-column>
      <el-table-column prop="hdFz" label="分数">
      </el-table-column>
      <el-table-column prop="hdPm" label="排名">
      </el-table-column>
    </el-table>
    <div class="avue-crud__pagination" width="90%">
      <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage" background layout="total, sizes, prev, pager, next">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import {
  userHdzhhzbPage
} from "@/api/ceping/cepinghdglb";
import {
  mapGetters
} from 'vuex'
export default {
  data() {
    return {
      dataForm: {
        key: ''
      },
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      addOrUpdateVisible: false
    }
  },
  created() {
    this.getDataList();
  },
  computed: {
    ...mapGetters(['permissions'])
  },
  methods: {

    // 获取数据列表 预览分页查询使用
    getDataList() {
      this.dataListLoading = true
      userHdzhhzbPage(Object.assign({
        current: this.pageIndex,
        size: this.pageSize
      })).then(response => {
        this.dataList = response.data.data.records
        this.totalPage = response.data.data.total
      })
      this.dataListLoading = false
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val
      this.getDataList()
    },

    // 删除
    deleteHandle(id) {
      this.$confirm('是否确认删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function () {
        return delObj(id)
      }).then(data => {
        this.$message.closeAll();
        this.$message.success('删除成功')
        this.getDataList()
      })
    }
  }
}

</script>
